home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-21 | 1.8 KB | 74 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWPostEx.cpp
- // Release Version: $ 1.0d1 $
- //
- // Creation Date: 3/28/94
- //
- // Copyright: © 1994 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWPOSTEX_H
- #include "FWPostEx.h"
- #endif
-
- #ifndef FWPRIMEM_H
- #include "FWPriMem.h"
- #endif
-
- #ifndef FWPRIDEB_H
- #include "FWPriDeb.h"
- #endif
-
- #ifndef FWEXCDEF_H
- #include "FWExcDef.h"
- #endif
-
- #ifdef FW_BUILD_MAC
- #pragma segment BEL
- #endif
-
- void FW_CPostedException::Initialize(FW_SPrivPostedExceptionGlobals& globals)
- {
- globals.gMaxPostedSize = _FW_CExceptionRuntime::kDefaultExceptionBufferSize;
-
- globals.gPostedException = (_FW_CException*)
- ::FW_PrimitiveAllocateBlock(globals.gMaxPostedSize);
- FW_PRIV_ASSERT(globals.gPostedException != 0);
-
- globals.gPending = 0;
-
- FW_PRIV_ASSERT(!globals.gInitialized);
- globals.gInitialized = 1;
- }
-
- void FW_CPostedException::Terminate()
- {
- FW_SPrivPostedExceptionGlobals& globals = GetPostedExceptionGlobals();
- FW_PRIV_ASSERT(globals.gInitialized);
- ::FW_PrimitiveFreeBlock(globals.gPostedException);
- globals.gInitialized = 0;
- }
-
- void FW_CPostedException::PostException(const _FW_CException& exception)
- {
- FW_SPrivPostedExceptionGlobals& globals = GetPostedExceptionGlobals();
- FW_PRIV_ASSERT(globals.gInitialized);
- if (!globals.gPending)
- {
- exception.Copy(globals.gPostedException, globals.gMaxPostedSize);
- globals.gPending = 1;
- }
- }
-
- void FW_CPostedException::ThrowPostedException()
- {
- FW_SPrivPostedExceptionGlobals& globals = GetPostedExceptionGlobals();
- FW_PRIV_ASSERT(globals.gInitialized);
- if (globals.gPending)
- {
- globals.gPending = 0;
- FW_THROW(*globals.gPostedException);
- }
- }